#include <iostream>

class A {
public:
    void func() { std::cout << "A: func()" << std::endl; }
};

// 派生类B，虚拟继承自A
class B : virtual public A { };

// 派生类C，虚拟继承自A
class C : virtual public A { };

// 派生类D，继承自B和C
class D : public B, public C { };

int main() {
    D obj;
    obj.func(); // 不会产生二义性，正常调用A的func()
    return 0;
}